#ifndef _OBJECT_
#define _OBJECT_

#include <stdio.h>
#include "Common.h"


#define OBJECT_NB 5


typedef enum
{
    OBJECT_MODEL_CHAIR0,
    OBJECT_MODEL_PHOTOCOPIER
} ObjectModel;

typedef struct
{
    char* name;
    int duration;
    char experience;
    //int reqType;
    //short price;
    char usury;
} ObjectAction;

typedef struct
{
    int model;

    int width;
    int height;

    unsigned char* content;
    COORD accessor;

    int actionCount;
    ObjectAction* action;
} ObjectData;

typedef struct
{
    COORD position;
    int busy;
    int usury;
    ObjectData* data;
} Object;

extern Object** objectList;
extern int      objectCount;
extern Object*  objectSelected;
extern Mutex    objectMutex;

void LoadObject(FILE* file);
Object* CreateObject(int objModel, short x, short y);

Object* AddNewObject(int objModel, int x, int y);
void RemoveObject(int x, int y);

ObjectData* LoadObjectData(int model);

COORD GetObjectRealPosition(Object* obj);
Object* GetObjectByPosition(COORD coord);
Object* GetObjectByPositionXY(int x, int y);

COORD GetObjectAccessor(Object* obj);
int IsObjectAccessor(COORD pos, Object* obj);

#endif
